package com.zan.pattern.strategy;

import java.util.Arrays;
import java.util.Comparator;

/**
 * @Author Zan
 * @Create 2024/4/26 21:21
 * @Description : TODO(请用一句话描述该类的功能)
 * @ClassName: Demo
 */
public class Demo {
    public static void main(String[] args) {

        Integer[] data = {12, 2, 3, 2, 4, 5, 1};
        // 实现降序排序
        Arrays.sort(data, new Comparator<Integer>() {
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;
            }
        });
        System.out.println(Arrays.toString(data)); //[12, 5, 4, 3, 2, 2, 1]
    }
}
